// pages/collect/index.js
import { request } from '../../request/http.js';
import regeneratorRuntime from '../../lib/runtime/runtime.js';
Page({
  data: {
    // 未卖出 状态0
    mysell: [],
    //
  },

 onShow: function () {
    this.getmysell();
  },
  async getmysell(){
    const openid = wx.getStorageSync('OPENID');
    const result = await request({ name: 'mysell', data: { openid: openid } });
    this.setData({ mysell: result.data.message })
  },
  async deletegoods(e){
    // console.log("测试");
    const goods_id=e.currentTarget.dataset.index;
    console.log(goods_id);

    const openid = wx.getStorageSync('OPENID');
    const result = await request({ name: 'deletegoods', data: { openid: openid,goods_id:goods_id } });
    console.log(result);
    // this.setData({ mysell: result.data.message })
    if(result.statusCode===200){
      this.getmysell();
      console.log("删除成功");
      wx.showToast({ title: "操作成功", icon: 'success', mask: true })
      // wx.showToast({
      //   title: "操作成功", icon: 'success', mask: true, success: function () {
      //     setTimeout(function () {    
      //     }, 500)
      //   }
      // })
      // this.getmysell();

    }

  }

})